package com.qf.service.impl;

import com.qf.entity.Room;
import com.qf.entity.RoomDTO;
import com.qf.entity.RoomVO;
import com.qf.mapper.RoomMapper;
import com.qf.service.RoomService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.text.SimpleDateFormat;
import java.util.Collections;
import java.util.Date;
import java.util.List;

/**
 * @ClassName: RoomServiceImpl
 * @Author: WangHao
 * @Date: 2025/4/27 16:29
 * @Description:
 * @Version: 1.0
 */
@Service
public class RoomServiceImpl implements RoomService {

    @Autowired
    private RoomMapper roomMapper;

    @Override
    public List<Room> findAll(RoomDTO roomDTO) {
        return roomMapper.findAll(roomDTO);
    }

    @Override
    public boolean delRoomById(Integer id) {
        return roomMapper.delRoomById(id);
    }

    @Override
    public boolean delRoomByIds(Integer[] ids) {
        return roomMapper.delRoomByIds(ids);
    }

    @Override
    public boolean addRoom(RoomDTO roomDTO) {
        Date date = new Date();
        roomDTO.setCreateTime(date);
        return roomMapper.addRoom(roomDTO);
    }

    @Override
    public boolean updateRoom(RoomDTO roomDTO) {
        Date date = new Date();
        roomDTO.setUpdateTime(date);
        return roomMapper.updateRoom(roomDTO);
    }

    @Override
    public List<RoomVO> getRoomType() {
        return roomMapper.getRoomType();
    }

    @Override
    public void insertBatch(List<Room> cachedDataList) {
        roomMapper.insertBatch(cachedDataList);
    }

}
